<?php

use App\Enums\LayerPosition;
use App\Enums\LayerType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('designs', function (Blueprint $table) {
            $table->id();
            $table->application();
            $table->unsignedBigInteger('season_id')
                ->index();
            $table->integer('order')
                ->default(0);
            $table->enum('type', LayerType::values())
                ->comment('图层类型');
            $table->json('config')
                ->comment('图层配置')
                ->nullable();
            $table->enum('position', LayerPosition::values())
                ->nullable();
            $table->unsignedMediumInteger('x_axis')
                ->default(0);
            $table->unsignedMediumInteger('y_axis')
                ->default(0);
            $table->easyStatus();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('designs');
    }
};
